package org.teach.study.aigo.study_spr;

import org.omg.CORBA.CTX_RESTRICT_SCOPE;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.teach.study.aigo.study_spr.hello.HelloDao;
import org.teach.study.aigo.study_spr.hello.impl.HelloDaoImpl;
import org.teach.study.aigo.study_spr.service.HelloService;

/**
 * Hello world!
 * 主函数 启动类
 */

//@Configuration
//@ComponentScan(basePackages = "org.teach.study.aigo.study_spr")
public class App 
{
    public static void main( String[] args )
    {
 /*
        HelloDao dao=new HelloDaoImpl();
        dao.sayhello();
*/
        
//        ClassPathXmlApplicationContext ctx=new ClassPathXmlApplicationContext("/applicationContext.xml"); 
//    	HelloDao dao=ctx.getBean(HelloDao.class);
//    	dao.sayhello();
//    	dao=(HelloDao)ctx.getBean("OyhDao");
//    	dao.sayhello(); 
//    	ctx.close();
    /*	ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/applicationContext.xml");
    	HelloDao dao = context.getBean(HelloDao.class);
    	dao.sayhello();
    	context.close();*/

    	ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/applicationContext.xml");		
    	HelloService service = context.getBean(HelloService.class);
    	service.saytest();
    	context.close();
    }
}
